import React from 'react'
import { Button, Input, Row, Col, Form } from 'antd'
import HanWang from 'components/han-wang'

export default {
  key: 'han-wang',
  name: 'HanWang 汉王e拍仪',
  author: '张然',
  description: '汉王e拍仪，只有在安装了官方驱动的windows电脑上可以使用，调试请配置好环境。',
  isExampleFull: false,
  api: [
    {
      title: 'API',
      data: [],
      description: ''
    }
  ],
  example: [
    {
      title: '基础用法',
      description: '只在配置了扫描仪环境的机器上可用。',
      state: {
        imageList: []
      },
      getMethod: context => {
        return {
          onCapture: image => {
            const { imageList }  = context.state;
            imageList.push(`data:image/bmp;base64,${image}`);
            console.log(imageList);
            context.setState({ imageList });
          }
        }
      },
      getContent: context => {
        const { imageList } = context.state;
        return (
          <div>
            <HanWang onCapture={context.onCapture}>
              拍照
            </HanWang>
            <div style={{ marginTop: 20 }}>
              {imageList.map((image, index) => <img
                key={index}
                src={image}
                style={{ width: 200, height: 200, display: 'block', marginTop: 10 }}
              />)}
            </div>
          </div>
        )
      }
    }
  ]
}
